<template>
<div class="wrapper">
    <div class="swiper">
        <swiper :options="swiperOption">
            <swiper-slide v-for="item of this.list" :key="item.id">
                <img class='swiper-img' :src="item.imgUrl" alt="">
            </swiper-slide>
            <div class="swiper-pagination"  slot="pagination"></div>
        </swiper>
    </div>
</div>
</template>
<script>
export default {
  name: 'HomeSwiper',
  props: {
    list: Array
  },
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        // {
        //   // 分页器对应的html元素
        //   el: '.swiper-pagination'
        //   // // 分页器的样式
        //   // type: 'bullets',
        //   // // 分页器内的元素，添加类名
        //   // bulletClass: 'custom-bullet-class'
        // },
        loop: true,
        autoplay: 3000,
        speed: 1000
        // swiper 高度跟随slide高度变化
        // autoHeight: true
      }
    }
  }
}
</script>
<style lang="stylus" scoped>
//分页器未选中
.wrapper >>> .swiper-pagination-bullet
  box-sizing border-box
  border-radius 100%
  height 6px
  width  6px
  border 1px solid #fff
  display inline-block
  margin 0 4px
  opacity 1
  //分页器选中状态
.wrapper >>> .swiper-pagination-bullet-active
  background-color: #fff
  box-sizing border-box
  border-radius 100%
  height 6px
  width  6px
  border 1px solid #fff
  display inline-block
  margin 0 4px
  opacity 1
.wrapper >>> .swiper-slide
  height 220px
.swiper
    overflow: hidden
    width : 100%
    height: 220px
    background-color: #ccc
    .swiper-img
        width :100%
        height 100%
</style>
